import request from '@/utils/request'

//新增表单分类
export function createTemplate(data) {
    return request({
        url: '/notify/message-template/create',
        method: 'post',
        data: data
    })
}

// 系统消息模板
export function getTemplateList(data) {
    return request({
        url: '/notify/message-template/page',
        method: 'post',
        data: data
    })
}

// 更新信息模板

export function updataTemplate(data) {
    return request({
        url: '/notify/message-template/update',
        method: 'PUT',
        data: data
    })
}

// 草稿分页
export function getDraft(data) {
    return request({
        url: '/bpm/process-instance/my-draft',
        method: 'get',
        params: data
    })
}

// 草稿详情
export function getDataOneId(data) {
    return request({
        url: '/form/project/getDataOneId',
        method: 'get',
        params: data
    })
}

// 批量删除草稿
export function delMulti(data) {
    return request({
        url: '/bpm/process-instance/my-drafts',
        method: 'delete',
        data: data
    })
}

// 普通消息列表
export function getAnnouncement(data) {
    return request({
        url: '/notify/announcement/page',
        method: 'post',
        data: data
    })
}

// 新增普通消息
export function creatAnnouncement(data) {
    return request({
        url: '/notify/announcement',
        method: 'post',
        data: data
    })
}

// 修改普通消息
export function updateAnnouncement(data) {
    return request({
        url: '/notify/announcement',
        method: 'put',
        data: data
    })
}

// 我的消息列表
export function getMyMessage(data) {
    return request({
        url: '/notify/user-announcement/page',
        method: 'post',
        data: data
    })
}

// 我的消息 -- 删除
export function delMyMessage(id) {
    return request({
        url: `/notify/user-announcement/${id}`,
        method: 'delete',
    })
}

// 我的消息 -- 已读
export function readMyMessage(data) {
    return request({
        url: '/notify/user-announcement/read',
        method: 'PATCH',
        data: data
    })
}

// 我的消息 -- 批量删除
export function delMultiMyMessage(data) {
    return request({
        url: '/notify/user-announcement/list',
        method: 'delete',
        data: data
    })
}

// 我的消息 -- 查看 通过id查询公告信息
export function getDetailMyMessage(id) {
    return request({
        url: `/notify/announcement/${id}`,
        method: 'get'
    })
}

// 普通消息 -- 删除
export function delAnnouncement(id) {
    return request({
        url: `/notify/announcement/${id}`,
        method: 'delete'
    })
}

//普通消息 -- 撤回
export function withdrawAnnouncement(announcementId) {
    return request({
        url: `/notify/announcement/close/${announcementId}`,
        method: 'PATCH',
    })
}

// 普通消息 -- 发送详情
export function getAnnouncementSend(data) {
    return request({
        url: '/notify/user-announcement/send/page',
        method: 'get',
        params: data
    })
}

//普通消息-- 发送详情 -- 删除
export function delSend(id) {
    return request({
        url: `/notify/user-announcement/send/${id}`,
        method: 'delete'
    })
}

// oneBi
export function getOneBIstr(data) {
    return request({
        url: '/system/user/infoSecret',
        method: 'get',
    })
}

// 系统消息模板 发送详情
export function getTemplatePage(data) {
    return request({
        url: '/notify/user-announcement/send/templatePage',
        method: 'get',
        params: data
    })
}

// 抄送我的 列表
export function getCarbonList(data) {
    return request({
        url: '/bpm/task/carbon-copy',
        method: 'get',
        params: data
    })
}

// 查看 抄送
export function checkCarbonList(carbonId){
    return request({
        url: `/bpm/task/carbon-copy/${carbonId}`,
        method: 'get',
    })
}

// 抄送 删除
export function delCarbonList(id) {
    return request({
        url: `/bpm/task/carbon-copy/${id}`,
        method: 'delete'
    })
}

// 抄送 批量删除
export function delMultiCarbonList(data) {
    return request({
        url: '/bpm/task/batchDelete',
        method: 'delete',
        data: data
    })
}

//普通消息 -- 消息内容查询
export function getMessageListByDictType(type){
    return request({
        url: `/system/dict-data/getMessageListByDictType?dictType=${type}`,
        method: 'get',
    })
}

// 我的消息 -- 消息类型查询  /system/dict-data/getMessageListByDictType?dictType=messageGroup
export function getMyMessageByDictType(type) {
    return request({
        url: `/system/dict-data/getMessageListByDictType?dictType=messageGroup`,
        method: 'get',
    })
}